import {ElementType} from "@hufe921/canvas-editor";
import _ from "lodash";

let start = false;
const info = (d, ...argument) => {
    if (!window.editor) {
        return
    }
    if (!start) {
        window.editor.command.executeSelectAll();
        start = true;
    }
    const a = window.editor.command.getText();
    if (a.main.length >= 100000) {
        const text = a.main.substring(100000);
        window.editor.command.executeSelectAll();
        window.editor.command.executeInsertElementList([
            {
                type: ElementType.TEXT,
                value: text
            }
        ]);
    }

    d += "\n";

    window.editor.command.executeInsertElementList([
        {
            type: ElementType.TEXT,
            value: d
        }
    ]);
}


export {info}